﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.IO;
using System.Reflection;

namespace blackhouse.Web {
	public class AssemblyImageWatermark : ImageWatermark {

		#region Properties

		public string ImageAssembly { get; set; }
		public string ImageFile { get; set; }

		#endregion

		#region Constructors

		public AssemblyImageWatermark(string imageAssembly, string imageFile, float percentWidth, float percentHeight, float percentPositionX, float percentPositionY)
			: base(percentWidth, percentHeight, percentPositionX, percentPositionY) {
				this.ImageAssembly = imageAssembly;
				this.ImageFile = imageFile;
		}

		#endregion

		#region Methods

		public override Stream GetImageStream() {
			Assembly assembly = Assembly.ReflectionOnlyLoad(this.ImageAssembly);
			return assembly.GetManifestResourceStream(this.ImageFile);
		}

		public override string ToString() {
			return string.Format("{0}-{1}-{2}-{3}-{4}-{5}", ImageAssembly, ImageFile, PercentWidth, PercentHeight, PercentPositionX, PercentPositionY);
		}

		#endregion

	}
}